/*
 * CacheUtils.c
 *
 *  Created on: Mar 26, 2012
 *      Author: kody
 */
#include "CacheUtils.h"
#include "config.h"

void initResults(results_s * results)
{
	memset(results,0,sizeof(results_s));
}
void printResults(results_s * results)
{
        printf("--------------------------------------------------------------------------\n");
        printf("                         Simulation Results                               \n");
        printf("--------------------------------------------------------------------------\n");
        /*Print out Memory System Configuration*/
        printConfig();

        /*Print out Exec time and Refs information*/
        printf("Execute time = %ld     Total Refs = %ld\n",
                        results->executeTime,
                        (results->dataRefs+results->instRefs));
        printf("Instruction Refs = %ld     Data Refs = %ld\n",
                                results->instRefs,
                                results->dataRefs);
        /*Print out Number of Instructions and Percentage*/
        printf("Number of Instructions:     [Percentage]\n");
        printf("   Loads (L) = %ld    [%2.2f%%]   :   Stores (S) = %ld    [%2.2f%%]\n",
                        results->numInstr.numLoad,
                        (float)(results->numInstr.numLoad*100.0/(float)results->numInstr.numTotal),
                        results->numInstr.numStore,
                        (float)(results->numInstr.numStore*100.0/(float)results->numInstr.numTotal));
        printf("   Branch (B) = %ld    [%2.2f%%]   :   Computation (C) = %ld    [%2.2f%%]\n",
                                results->numInstr.numBranch,
                                (results->numInstr.numBranch*100.0/(float)results->numInstr.numTotal),
                                results->numInstr.numComp,
                                (results->numInstr.numComp*100.0/(float)results->numInstr.numTotal));
        printf("   Total = %ld\n",results->numInstr.numTotal);
        /*Print out Exec time and Refs information*/

}
